Skip to content

fix(bindeps): default artifacts to package target#17076

Open
npmccallum wants to merge 1 commit into
rust-lang:masterfrom
npmccallum:issue-17050-bindeps-forced-target
Open

fix(bindeps): default artifacts to package target#17076
npmccallum wants to merge 1 commit into
rust-lang:masterfrom
npmccallum:issue-17050-bindeps-forced-target

Conversation

@npmccallum

Copy link
Copy Markdown
Contributor

When an artifact dependency does not specify target, use the target selected for the dependency package. This lets packages that already declare an inherent per-package target avoid repeating that target on every artifact dependency edge.

The fallback honors forced-target, applies default-target only when no command-line target was specified, and lets an explicit artifact dependency target win.

Closes #17050.

When an artifact dependency does not specify `target`, use the target
selected for the dependency package. This lets packages that already
declare an inherent per-package target avoid repeating that target on
every artifact dependency edge.

The fallback honors `forced-target`, applies `default-target` only when
no command-line target was specified, and lets an explicit artifact
dependency `target` win.

Closes rust-lang#17050.
@rustbot rustbot added A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-features2 Area: issues specifically related to the v2 feature resolver A-profiles Area: profiles S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2026
@rustbot

rustbot commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@epage

epage commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

I actually wonder if we should dramatically rework per-package-target to be like required-features: include it if the target is selected and otherwise ignore it. This would likely negate the need for this change.

@npmccallum

Copy link
Copy Markdown
Contributor Author

@epage Regardless of how per-package-target works, I'm now of the opinion that this behavior probably isn't desirable. Imagine two crates: foo and bar. The foo crate has an artifact dependency on bar. For foo's bar dependency to magically pick up a target from another Cargo.toml feels very magical and unexpected. If foo doesn't pick a target for bar, then we should assume that bar has the same target as foo and fail if that can't work. This is the current behavior. I suggest we reject #17050.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-features2 Area: issues specifically related to the v2 feature resolver A-profiles Area: profiles S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

artifact-dependencies should auto use per-package-target forced-target

4 participants